/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package draftMate;

import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author brianjob
 */
public class TeamTable extends AbstractTableModel {
    private DraftMate draft;
    
    public TeamTable(DraftMate dm) {
        draft = dm;
    }
    
    @Override
    public int getColumnCount() {
        return Team.NUM_FIELDS;
    }
    
    @Override
    public int getRowCount() {
        return draft.numTeams();
    }
    
    @Override
    public String getColumnName(int col) {
        switch(col) {
            case Team.NAME:
                return "Name";
            case Team.AVG:
                return "Avg";
            case Team.R:
                return "R";
            case Team.RBI:
                return "RBI";
            case Team.HR:
                return "HR";
            case Team.SB:
                return "SB";
            case Team.W:
                return "W";
            case Team.ERA:
                return "ERA";
            case Team.WHIP:
                return "WHIP";
            case Team.K:
                return "K";
            case Team.SV:
                return "SV";
            default:
                return "ERROR";
        }
    }
    
    @Override
    public Object getValueAt(int row, int col) {
        return draft.getTeamStat(row, col);
    }
    
    @Override
    public Class getColumnClass(int c) {
        return getValueAt(0, c).getClass();
    }
    
    @Override
    public void setValueAt(Object value, int row, int col){
        // maybe implement later
    }
    
    @Override
    public boolean isCellEditable(int rowIndex, int columnIndex) {
        return false;
    }
}
